package twentytwentyone_3;

/**
 * @Author: Zahi
 * @Description:
 * @Date Created in 2021-03-15 12:52
 * @Modified By:
 */
public class CheckRecord_551 {
    public static void main(String[] args){
        String s = "PPALLL";
        System.out.println(checkRecord(s));
    }

    public static boolean checkRecord(String s){
        int ACount = 0;
        int LCount = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == 'A'){
                ACount++;
            }
            if (i < s.length() - 2){
                if (s.charAt(i) == 'L' && s.charAt(i + 1) == 'L' && s.charAt(i + 2) == 'L'){
                    LCount = 1;
                }
            }
        }
        return ACount <= 1 && LCount == 0;
    }
}
